Skip to content

Conversation

@P-SiZK
Copy link

@P-SiZK P-SiZK commented Jan 4, 2026

This PR fixes several issues in the Elixir lexer's sigil processing to match the Elixir language specification.

Changes

Fixed interpolation detection

  • Lowercase sigils (~s, ~r, ~c, ~w) support interpolation
  • Uppercase sigils (~S, ~R, ~C, ~W) do not support interpolation

In particular, uppercase letters sigils do not perform interpolation nor escaping. For example, although both ~s and ~S will return strings, the former allows escape codes and interpolation while the latter does not:

Ref: Interpolation and escaping in string sigils

Fixed sigil pattern regex

  • Changed from ~([a-zA-Z])? to ~([a-z]|[A-Z][A-Z0-9]*)
  • The sigil letter is now required (not optional), preventing errors when processing invalid patterns like ~()
  • Properly matches custom sigils like ~CUSTOM or ~ABC123

Custom sigils may be either a single lowercase character, or an uppercase character followed by more uppercase characters and digits.

Ref: Custom sigils

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant